﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;

namespace TST.SharePointObjects
{
    public class IsIndexedColumn : ITemplate
    {

        public IsIndexedColumn()
        {
        }

        public void InstantiateIn(Control container)
        {
            if (container != null)
            {
                CheckBox check = new CheckBox();
                check.Enabled = false;
                check.DataBinding += new EventHandler(check_DataBinding);
                container.Controls.Add(check);
            }
        }

        void check_DataBinding(object sender, EventArgs e)
        {
            CheckBox check = (CheckBox)sender;
            GridViewRow container = (GridViewRow)check.NamingContainer;
            SiteObject siteObject = (SiteObject)container.DataItem;
            check.Checked = siteObject.Index;
        }

     }
}
